home *** CD-ROM | disk | FTP | other *** search
- //////////////////////////
- // Harrow Software 1996
- // Good guy definition
- //
-
- message "Please execute game_1.sxt"
- return
-
- /////////////////////
- initialize: bitmaps
- my_sprite = new sprite
- $my_sprite.name = "good guy"
- direct = 0
- shooting = 0
- shoot_arm = 0
-
- left_bitmaps = bitmaps
- right_bitmaps = new list
- b = bitmaps loop n
- b2 = copy b
- flip FLIP_X bitmap b2
- right_bitmaps add b2
- bitmap b2 transparency 0,255,0
-
- /////////////////////
- set_position: x,y
- xpos = x
- ypos = y
-
- get_shot_position:
- shoot_arm = !shoot_arm
- shooting = TRUE
- if direct then xoff = !shoot_arm * 50
- else xoff = shoot_arm * 50 - 50
- return xpos+xoff, ypos+32, 30*direct-15, 11
-
- /////////////////////
- offset_position: xoff, yoff // move the sprite
- xpos = xpos + xoff
- ypos = ypos + yoff
- bound xpos, ypos window // confine sprite to window
- if xoff > 0 then direct = 1
- else direct = 0
-
- //////////////////
- update_sprite:
- // select the appropriate bitmap
- //
- if direct then bitmaps = right_bitmaps
- else bitmaps = left_bitmaps
- if shooting then index = 1 + shoot_arm
- else index = 0
- shooting = 0
-
- my_bitmap = bitmaps get index
-
- xmid = my_bitmap.xlen/2 // offset from center
- ymid = my_bitmap.ylen/2
-
- sprite my_sprite bitmap my_bitmap at xpos-xmid, ypos-ymid depth ypos
-
- ///////////////////////////////////
- ////////////////////////////
-
-
-